﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace MoodleLoginDelayTestConfig
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        XmlDocument xDoc = new XmlDocument();

        private void Form1_Load(object sender, EventArgs e)
        {
            xDoc.Load("MoodleLoginDelayTest.exe.config");
            XmlNode webServicePathValue = xDoc.SelectSingleNode("//setting[@name='MoodleLoginDelayTest_WSMoodle_MoodleWS']/value");
            XmlNode moodleLoginURL = xDoc.SelectSingleNode("//setting[@name='MoodleLoginURL']/value");
            XmlNode MoodleURL = xDoc.SelectSingleNode("//setting[@name='MoodleURL']/value");
            tbxWebServiceURL.Text = webServicePathValue.InnerText;
            tbxTestLoginURL.Text = moodleLoginURL.InnerText;
            tbxMoodleURL.Text = MoodleURL.InnerText;
        }

        private void btSave_Click(object sender, EventArgs e)
        {
            xDoc.SelectSingleNode("//setting[@name='MoodleLoginDelayTest_WSMoodle_MoodleWS']/value").InnerText = tbxWebServiceURL.Text;
            xDoc.SelectSingleNode("//setting[@name='MoodleLoginURL']/value").InnerText = tbxTestLoginURL.Text;
            xDoc.SelectSingleNode("//setting[@name='MoodleURL']/value").InnerText = tbxMoodleURL.Text;
            xDoc.Save("MoodleLoginDelayTest.exe.config");
        }

        private void pxLogo_Click(object sender, EventArgs e)
        {

        }

        private void lblTitle_Click(object sender, EventArgs e)
        {

        }

    }
}
